package com.baizhi.service.impl;

import com.baizhi.dao.AlbumDao;
import com.baizhi.entity.Album;
import com.baizhi.service.AlbumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class AlbumServiceImpl implements AlbumService {
    @Autowired(required = false)
    private AlbumDao albumDao;


    @Override
    public Map selectAll(int page, int limit, String albumName) {
        int offset=(page-1)*limit;
        List<Album> list=albumDao.selectAll(offset,limit);
        int count=albumDao.selectCount(albumName);
        Map map=new HashMap();
        map.put("data",list);
        map.put("count",count);
        map.put("code",0);
        map.put("msg","");
        return map;
    }

    @Override
    public Album selectOne(int id) {
        return albumDao.selectOne(id);
    }
}
